import { getBannerData, getLevelListData, getFloorData } from "@/api"

export default {
  namespaced: true,
  state: {
    levelData: [],
    bannerList: [],
    floorData: [],
  },
  getters: {},
  actions: {
    async getListData({ commit }) {
      const result = await getLevelListData()
      if (result.code === 200) {
        commit("GET_LEVE_LLIS_TDATA", result.data)
      } else {
        console.log(result.message)
      }
    },
    async getBanner({ commit }) {
      const result = await getBannerData()
      if (result.code === 200) {
        commit("GET_BANNER", result.data)
      } else {
        console.log(result.message)
      }
    },
    async getFloor({ commit }) {
      const result = await getFloorData()
      if (result.code === 200) {
        commit("GET_FLOOR", result.data)
      } else {
        console.log(result.message)
      }
    },
  },
  mutations: {
    GET_LEVE_LLIS_TDATA(state, data) {
      state.levelData = data
    },
    GET_BANNER(state, data) {
      state.bannerList = data
    },
    GET_FLOOR(state, data) {
      state.floorData = data
    },
  },
}
